<!--?xml version="1.0" encoding="UTF-8"?--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head>
  <title>Git学习四：远程仓库</title>
 </head>
 <body>
  <div>
   git 远程仓库命令
  </div>
  <div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);-en-codeblock:true;">
   <div>
    git remote -v
   </div>
   <div>
    <br />
   </div>
   <div>
    #结果
   </div>
   <div>
    <span style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">origin&nbsp;&nbsp;&nbsp;&nbsp;</span>
    <a href="mailto:git@gitee.com" style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">git@gitee.com</a>
    <span style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">:m_aleen/shop.git (fetch)</span>
   </div>
   <div>
    <span style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">origin&nbsp;&nbsp;&nbsp;&nbsp;</span>
    <a href="mailto:git@gitee.com" style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">git@gitee.com</a>
    <span style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">:m_aleen/shop.git (push)</span>
   </div>
  </div>
  <div>
   <br />
  </div>
  <div>
   远程仓库的链接：(使用的是上面命令得到的远程地址)
  </div>
  <div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);-en-codeblock:true;">
   <div>
    git remote add origin&nbsp;
    <a href="mailto:git@gitee.com" style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">git@gitee.com</a>
    <span style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">:m_aleen/shop.git</span>
   </div>
  </div>
  <div>
   <br />
  </div>
  <div>
   推送数据到远程：
  </div>
  <div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);-en-codeblock:true;">
   <div>
    git push -u origin master
   </div>
   <div>
    <br />
   </div>
   <div>
    #第一次push时远程仓库并没有你的本地分支，所以需要加入-u参数
   </div>
   <div>
    #第一次以后直接执行git push即可
   </div>
  </div>
  <div>
   <br />
  </div>
  <div>
   远程代码的拉取：
  </div>
  <div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);-en-codeblock:true;">
   <div>
    #获取得到新的项目
   </div>
   <div>
    git clone&nbsp;
    <a href="mailto:git@gitee.com" style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">git@gitee.com</a>
    <span style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">:m_aleen/shop.git</span>
   </div>
   <div>
    <div>
     <br />
    </div>
    <div>
     #获取其他工作者修改的项目文件
    </div>
   </div>
   <div>
    git pull
   </div>
  </div>
  <div>
   <br />
  </div>
  <div>
   远程仓库链接关闭：
  </div>
  <div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);-en-codeblock:true;">
   <div>
    git remote rm origin
   </div>
  </div>
  <div>
   <br />
  </div>
  <div>
   出现拒接merge时使用：
  </div>
  <div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);-en-codeblock:true;">
   <div>
    <span style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">git pull --allow-unrelated-histories</span>
   </div>
   <div>
    <span style="font-family: Monaco; font-size: 12px; color: rgb(51, 51, 51);">//强制合并不相干的分支</span>
   </div>
   <div>
    git pull origin master --allow-unrelated-histories
   </div>
  </div>
  <div>
   <br />
  </div>
 </body>
</html>